package com.zzk.workmodule.ui.work;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableList;

import com.zzk.rxmvvmbase.base.BaseViewModel;
import com.zzk.workmodule.BR;
import com.zzk.workmodule.R;

import me.tatarka.bindingcollectionadapter2.ItemBinding;

/**
 * @ProjectName: RXMVVMBaseComponent
 * @Package:
 * @ClassName:
 * @Description:
 * @Author: brilliantzhao
 * @CreateDate: 2021.1.14 9:39
 * @UpdateUser:
 * @UpdateDate: 2021.1.14 9:39
 * @UpdateRemark:
 * @Version: 1.0.0
 */
public class WorkViewModel extends BaseViewModel {

    //给RecyclerView添加ObservableList
    public ObservableList<WorkItemViewModel> observableList = new ObservableArrayList<>();
    //给RecyclerView添加ItemBinding
    public ItemBinding<WorkItemViewModel> itemBinding = ItemBinding.of(BR.viewModel, R.layout.grid_work);

    public WorkViewModel(@NonNull Application application) {
        super(application);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        for (int i = 0; i < 20; i++) {
            observableList.add(new WorkItemViewModel(this, "条目" + i));
        }
    }
}
